using PP.Basic;
using System;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

namespace PP.PPPoker.Game.GJ25
{
    /// <summary>
    /// GJScoreEffect 对象
    /// </summary>
    public class GJScoreEffect : MonoBehaviour
    {
        private const string Tag = nameof(GJScoreEffect);

        // Private Variables Begin
        private AnimationTrigger AnimationTrigger => _animationTrigger ?? (_animationTrigger = transform.GetComponentEx<AnimationTrigger>());
        private AnimationTrigger _animationTrigger;
        // Private Variables End

        // Static Methods Begin
        public static GJScoreEffect Create()
        {
            return null;
        }
        // Static Methods End
        
        // Public Methods Begin


        public void ShowTypeScore(GJHandType type)
        {
            gameObject.SetActive(true);

            // _typeImage.sprite = GJCard.GetCardTypeSprite(type);

            if (GJPathHelper.HandTypeDisplay.TryGetValue(type, out string displayStr))
                _typeImage.sprite = Resources.Load<Sprite>(displayStr);

            Debug.Log($"{Tag}.ShowTypeScore -> displayStr: {displayStr}");

            // _scoreTextTmp.text = $"+ {score}";
            // _hpTextTmp.text = $"HP: +{hp}";

            AnimationTrigger.Play("GJScoreEffetOpen", () =>
            {
                gameObject.SetActive(false);
            });
        }



        // Public Methods End
        
        // Lifecycle Methods Begin
        protected void Awake()
        {
            InitHier();
            InitPart();
        }

        private void InitPart()
        {
            // Do initialization here...
        }
        
        private void Start()
        {
            Debug.Log($"{Tag}.Start");
        }
        
        // Lifecycle Methods End

        // Hier Components Begin        
        private Image _typeImage;
        private TMP_Text _typeTextTmp;

        private void InitHier()
        {
            _typeImage = transform.Find("Content/_Image_Type").GetComponent<Image>();
        }

        // Hier Components End


    }
}
